<!DOCTYPE html>
<html>
<head>
    <title>添加商品</title>
    <meta charset="utf-8">
    <link href="/stylesheets/bootstrap.min.css" rel="stylesheet" media="screen">
    <script src="../javascripts/jquery-1.12.2.min.js"></script>
    <script src="/javascripts/bootstrap.min.js" type="text/javascript"></script>
    <% include ../includes/head%>
    <style type="text/css">

    </style>
    <script type="text/javascript">
        // function addcommodity(){
        //         var name = $('#cname').val(), price = $('#cprice').val();
        //         var data = { "name": name, price:price,"imgSrc": "xmsz-"+Math.floor(Math.random()*5+1)+".jpg"};
                
        //         $.ajax({
        //             url:'/addcommodity',
        //             type:'POST',
        //             data:data,
        //             success:function(data,status){
        //                 if(status == 'success'){
        //                     alert('添加成功！')
        //                 }
        //             },
        //             error:function(data,err){
        //                 alert('添加失败！')
        //             }
        //         });
        // }
    </script>
</head>
<body>
<% include ../includes/header%>



<div id="container-inner">
        <ul id="breadcrumb-wrapper">
        
            <li>
                <a href="index.html">
                <ins>
                    <div class="br-left"></div>
                    <div class="br-mid">
                        主页
                    </div><!--br-mid-->
                    <div class="br-right">
                    </div><!--br-right-->
                </ins>    
                </a>
            </li>  
            
            <li>
                <a href="blog.html">
                <ins>
                    <div class="br-left"></div>
                    <div class="br-mid">
                        新闻列表
                    </div><!--br-mid-->
                    <div class="br-right">
                    </div><!--br-right-->
                </ins>    
                </a>
            </li>
            
           
            <li id="page-title">
                新闻列表
            </li><!--page-title-->
        </ul>
        <div id="inner-border"></div>
        <div class="clear"></div>
        <div id="contentwrap-inner">
            
            
                
                <a class="btn  btn-xs btn-success" href="home" style="margin-left: 725px;margin-bottom: 20px;">返回商品页</a>
                <form action="/addcommodity"  role="form" method="post" class="form-horizontal" enctype="multipart/form-data">
                    <div class="form-group">
                        <label for="cname" class="col-sm-2 control-label">商品名称</label>
                        <div class="col-sm-10">
                            <input type="text" name ="name" id="cname" class="form-control" value= "<%= commodity.name %>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="cprice" class="col-sm-2 control-label">商品价格</label>
                        <div class="col-sm-10">
                            <input type="text" name ="price" id="cprice" class="form-control" value= "<%= commodity.price %>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputDoctor" class="col-sm-2 control-label">商品简介</label>
                        <div class="col-sm-10">
                            <textarea type="text" name="summary" id="inputText" class="form-control" value="<%= commodity.summary %>"><%= commodity.summary %></textarea>
                            
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="photo" class="col-sm-2 control-label">商品图片地址</label>
                        <div class="col-sm-10">
                            <input type="text" name ="imgSrc" id="photo" class="form-control" value= "<%= commodity.imgSrc %>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPoster" class="col-sm-2 control-label">商品图片上传</label>
                        <div class="col-sm-10">
                            <input type="file" name="uploadPoster" id="uploadPoster" >
                        </div>
                    </div>
                    <input type="text" style="display: none" name="id" value="<%= commodity._id%>">
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit">录入</button>
                        </div>
                    </div>
                </form>
            
            <div class="clear"></div>
        </div>      
    </div>
<% include ../includes/footer%>
</body>
</html>


